package team.kirohuji.discovery;

import java.util.ArrayList;

public class Device {
	private String name;
	private int type;
	private ArrayList<String> interfaces;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public ArrayList<String> getInterfaces() {
		return interfaces;
	}
	public void setInterfaces(ArrayList<String> interfaces) {
		this.interfaces = interfaces;
	}
	public boolean addInterface(String i){
		interfaces.add(i);
		return true;
	}
	public boolean removeInterface(String i) {
		int index=-1;
		for(int j=0;j<interfaces.size();j++) {
			if(interfaces.get(j).equals(i)) {
				index=j;
			}
		}
		if(index==-1) {
			System.out.println("此设备的接口没有此ip地址");
			return false;
		}
		interfaces.remove(index);
		return true;
	}
}
